<?php
$menumark = 'user';
switch ($act) {
    //#####################@ 修改分类 @#####################//
    case 'find':

        $sql = "select * from wxgg_user where user_wxid like '%{$_p_wxid}%'";
        $user = $db->sql_selectall($sql);
        include(pe_tpl('user_list.html'));
        break;

    case 'edit':
        include(pe_tpl('user_edit.html'));
        break;

    case 'add':
        include(pe_tpl('user_add.html'));
        break;
    //#####################@ 分类列表 @#####################//

    case 'detail':
        $order = $db->pe_selectall('order',array('order_userid'=>$_g_id));
        foreach ($order as $k => $v) {
            $house = $db->pe_select('house', array('house_id' => $v['order_houseid']));
            $order[$k]['order_housename'] = $house['house_name'];
        }

        include(pe_tpl('user_detail.html'));
        break;

    case 'charge':
        $user = $db->pe_select('user',array('user_id'=>$_g_id));
        if(!empty($user)){
            $charge_record = $db->pe_selectall('moneycard_record',array('record_wxid'=>$user['user_wxid']));
        }


        include(pe_tpl('user_charge.html'));
        break;

    case 'pass':
        if($db->pe_update('userupdate',array('userupdate_id'=>$_g_id),array('userupdate_state'=>1))){
            pe_success('通过成功');
        }else{
            pe_error('通过失败');
        }

        break;

    case 'reject':
        if($db->pe_update('userupdate',array('userupdate_id'=>$_g_id),array('userupdate_state'=>2))){
            pe_success('拒绝成功');
        }else{
            pe_error('拒绝失败');
        }

        break;

    case 'reset':
        if($db->pe_update('user',array('user_id'=>$_g_id),array('user_pw'=>123))){
            pe_success('重置成功');
        }else{
            pe_error('重置失败');
        }

        break;


    case 'edit_apply':

        $user_update = $db->pe_selectall('userupdate',array('userupdate_state'=>0));
        foreach ($user_update as $k => $v){
            $user = $db->pe_select('user',array('user_id'=>$v['userupdate_user_id']));
            $user_update[$k]['user'] = $user;
        }
        include(pe_tpl('edit_apply.html'));
        break;



    default :

//        $sql = 'select u.user_id,u.user_name,u.user_headimg,u.user_wxid,u.user_phone,u.user_state,v.vipcard_category_id,vci.vipcategory_name from wxgg_user as u join wxgg_vipcard as v on u.user_vipcard_number = v.vipcard_number join wxgg_vipcategory as vci on v.vipcard_category_id = vci.vipcategory_id where u.user_id != 0';
//        $user = $db->sql_selectall($sql);

        $user = $db->pe_selectall('user','','*',array(5,$_g_page));


//        mp($user);exit;
        include(pe_tpl('user_list.html'));

        break;
}
?>